function varargout = AddSingleCase(varargin)
% This file is part of CISNE.
%
%     CISNE is free software: you can redistribute it and/or modify
%     it under the terms of the GNU General Public License as published by
%     the Free Software Foundation, either version 3 of the License, or
%     any later version.
%
%     CISNE is distributed in the hope that it will be useful,
%     but WITHOUT ANY WARRANTY; without even the implied warranty of
%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%     GNU General Public License for more details.
%
%     You should have received a copy of the GNU General Public License
%     along with CISNE.  If not, see <http://www.gnu.org/licenses/>.

% Copyright 2011. Jose Maria Garcia-Valdecasas Bernal

% Edit the above text to modify the response to help AddSingleCase

% Last Modified by GUIDE v2.5 21-Aug-2009 20:03:13

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @AddSingleCase_OpeningFcn, ...
                   'gui_OutputFcn',  @AddSingleCase_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before AddSingleCase is made visible.
function AddSingleCase_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to AddSingleCase (see VARARGIN)

% Choose default command line output for AddSingleCase
handles.output = hObject;

handles.CISNE=varargin{1};
% Update handles structure
guidata(hObject, handles);

% UIWAIT makes AddSingleCase wait for user response (see UIRESUME)
uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = AddSingleCase_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
if isfield(handles,'output')
varargout{1} = handles.output;
else
    varargout{1}=[];
end



function TL_Hs_Callback(hObject, eventdata, handles)
% hObject    handle to TL_Hs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of TL_Hs as text
%        str2double(get(hObject,'String')) returns contents of TL_Hs as a double


% --- Executes during object creation, after setting all properties.
function TL_Hs_CreateFcn(hObject, eventdata, handles)
% hObject    handle to TL_Hs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function TL_Tp_Callback(hObject, eventdata, handles)
% hObject    handle to TL_Tp (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of TL_Tp as text
%        str2double(get(hObject,'String')) returns contents of TL_Tp as a double


% --- Executes during object creation, after setting all properties.
function TL_Tp_CreateFcn(hObject, eventdata, handles)
% hObject    handle to TL_Tp (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function TL_Dir_Callback(hObject, eventdata, handles)
% hObject    handle to TL_Dir (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of TL_Dir as text
%        str2double(get(hObject,'String')) returns contents of TL_Dir as a double


% --- Executes during object creation, after setting all properties.
function TL_Dir_CreateFcn(hObject, eventdata, handles)
% hObject    handle to TL_Dir (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function TL_Boundary_Callback(hObject, eventdata, handles)
% hObject    handle to TL_Boundary (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of TL_Boundary as text
%        str2double(get(hObject,'String')) returns contents of TL_Boundary as a double


% --- Executes during object creation, after setting all properties.
function TL_Boundary_CreateFcn(hObject, eventdata, handles)
% hObject    handle to TL_Boundary (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in PB_OK.
function PB_OK_Callback(hObject, eventdata, handles)
% hObject    handle to PB_OK (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

Hs=get(handles.TL_Hs,'String');
Tp=get(handles.TL_Tp,'String');
theta=get(handles.TL_Dir,'String');
bound=get(handles.TL_Boundary,'String');
Lvl=get(handles.TL_Lvl,'String');

if ~strcmp(Hs,'')&~strcmp(Tp,'')&~strcmp(theta,'')&~strcmp(bound,'')&~strcmp(Lvl,'') %#ok<AND2>
    
    str=[bound ' ' Hs ' ' Tp ' ' theta ' ' Lvl];
    cases=get(handles.CISNE.LW_Cases,'String');
    cases{end+1}=str;
    set(handles.CISNE.LW_Cases,'String',cases);
    uiresume(handles.figure1);
end

% --- Executes on button press in PB_Cancel.
function PB_Cancel_Callback(hObject, eventdata, handles)
% hObject    handle to PB_Cancel (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
uiresume(handles.figure1);


function TL_Lvl_Callback(hObject, eventdata, handles)
% hObject    handle to TL_Lvl (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of TL_Lvl as text
%        str2double(get(hObject,'String')) returns contents of TL_Lvl as a double


% --- Executes during object creation, after setting all properties.
function TL_Lvl_CreateFcn(hObject, eventdata, handles)
% hObject    handle to TL_Lvl (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


